﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SuccinctCS
{
    public abstract class AList<T> : IImmutableList<T>
    {
        public virtual int Length {
            get
            {
                int count = 0;
                IImmutableList<T> t = this;
                while (!t.IsEmpty)
                {
                    count++;
                    t = t.Tail();
                }
                return count;
            }
        }

        


        abstract public T Head();
        abstract public IImmutableList<T> Tail();
        abstract public bool IsEmpty{get;}
    }
}
